<template>
	<view class="message-play" @tap="onNewsPage">
		<image src="/static/images/icon/horn.png" class="hornpng"></image>
		<swiper vertical="true" autoplay="true" duration="1000" circular="true" class="swiper-cont">
			<block v-for="(item, id) in news" :key="id">
				<swiper-item class="items">{{item.title}}</swiper-item>
			</block>
		</swiper>
		<text class="arrow"></text>
	</view>

</template>

<script>
	import http from '../../../../utils/http.js'
	export default {
		data() {
			return {
				news: []
			};
		},
		props: {
			dataField: {
				type: Object,
				default: () => ({})
			},
			shopId: {
				type: [Number, String],
				default: 0
			},
			will: {
				//需要获取的类型 默认首页
				type: String,
				default: 'home' //home 首页 ，feature 微页面  传 化名ID , goods 商品详情页，传商品ID ,ad 公共广告
			}
		},

		mounted() {
			this.getNoticeList()
		},

		methods: {
			getNoticeList() {
				// 加载公告
				var params = {
					url: "/shop/notice/topNoticeList/" + this.shopId,
					method: "GET",
					data: {},
					callBack: res => {
						this.setData({
							news: res
						});
						uni.hideLoading();
					}
				};
				http.request(params);
			},
			//跳转公告列表页面
			onNewsPage() {
				uni.navigateTo({
					url: '/packageUser/pages/recent-news/recent-news?shopId=' + this.shopId
				});
			},
		}
	};
</script>
<style>
	@import "./notice.css";
</style>
